package com.watson.todolist.testing;

import junit.framework.Assert;

import com.watson.todolist.EditTodoItemActivity;
import com.watson.todolist.R;
import com.watson.todolist.database.AccountManager;
import com.watson.todolist.database.DatabaseManager;
import com.watson.todolist.database.ToDoListManager;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.test.ActivityInstrumentationTestCase2;
import android.widget.EditText;

public class JaskoTest2 extends
		ActivityInstrumentationTestCase2<EditTodoItemActivity> {
	private EditText resultName;
	private EditText resultDesc;
	private String expectedName;
	private String expectedDesc;
	private Context context;

	public JaskoTest2() {
		super("com.watson.todolist", EditTodoItemActivity.class);
	}

	public JaskoTest2(Class<EditTodoItemActivity> name) {
		super(name);
	}

	protected void setUp() throws Exception {
		super.setUp();

		expectedName = "ToDoItem1";
		expectedDesc = "This is my first todo item";

		EditTodoItemActivity mainActivity = getActivity();

		resultDesc = (EditText) mainActivity
				.findViewById(R.id.descriptionOfTodoField);
		resultName = (EditText) mainActivity.findViewById(R.id.nameOfTodoField);

		resultDesc.setText(expectedDesc);
		resultName.setText(expectedName);

	}

	public void testEditPage() {
		assertNotNull(resultName);
		assertNotNull(resultDesc);
		Assert.assertEquals(expectedName, resultName.getText().toString());
		Assert.assertEquals(expectedDesc, resultDesc.getText().toString());
	}
}
